package com.example.kotlinlearn.kotlinLearn

open class Person(val gender:Boolean) {
    var name = ""
    var age = 0
    internal fun eat(){
        println(name+"吃饭了-年龄为："+age)
    }
}

class Student(val nameStu:String,val ageStu:Int, gender: Boolean) : Person(gender),Study {
    override fun readBooks() {
        println(nameStu+"开始阅读书籍")
    }

}

class Teacher(val name1:String, val age1:Int, gender: Boolean):Person(gender){
    //插件对象时一定会执行的方法init
    init {
        println(name1+"被实例化！！！！")
    }
    //次构造函数1
    constructor() : this("这个",0,true)
    //次构造函数2
    constructor(name2: String, age2: Int) :this()
    fun teach() = println("老师教学生$name1")
}

interface Study{
    fun readBooks()
    fun doHomeWork(){
        println("默认做家庭作业")
    }
}